﻿<Window x:Class="CapstoneProjectAEReader.GUIs.ReaderGUI.ReaderGui"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:controls="http://schemas.taloware.com.au/wpf/controls" 
        Title="Reader" Height="600" Width="900" Closed="Window_Closed">
    <Window.Resources>
        <DataTemplate x:Key="noteViewTemplate">
            <Grid Width="auto" Height="auto" Margin="4">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="*"/>
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="*"/>
                    <RowDefinition Height="*"/>
                </Grid.RowDefinitions>
                <Label Content="{Binding NoteContent}" HorizontalAlignment="Left" Grid.Column="0" Grid.Row="0"/>
            </Grid>
        </DataTemplate>
        <ContextMenu x:Key="bookmarkTabContextMenu">
            <MenuItem x:Name="bookmarkCtAdd" Click="btAddBookmark_Click" />
            <MenuItem x:Name="bookmarkCtEdit" Click="btEditBookmark_Click"/>
            <MenuItem x:Name="bookmarkCtDelete" Click="btDelBookmark_Click"/>
        </ContextMenu>
        <ContextMenu x:Key="noteTabContextMenu">
            <MenuItem x:Name="noteCtGoTo" Click="HandleBtGoto" />
            <MenuItem x:Name="noteCtEdit" Click="HandleBtEditNote"/>
            <MenuItem x:Name="noteCtDelete" Click="HandleBtDelNote"/>
        </ContextMenu>
    </Window.Resources>
    <Grid x:Name="BookReadingGrid" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
        <controls:DialogPresenter x:Name="listBoxDialogPresenter">
        <DockPanel>
            <Border BorderBrush="LightSkyBlue" BorderThickness="2,2,2,2" DockPanel.Dock="Top">
                <Grid>
                    <ToolBar Height="70" Name="toolBar1" MouseEnter="toolBar1_MouseEnter">
                        <Button x:Name="btFirstPage" Click="btFirstPage_Click" Background="Transparent" HorizontalAlignment="Center" Margin="10,2,2,2" 
                                VerticalAlignment="Center" BorderThickness="0">
                            <StackPanel>
                                <Image Source="Images/FirstPage.png" Height="32" Width="32"/>
                                <Label x:Name="lbFirstPage" HorizontalAlignment="Center"></Label>
                            </StackPanel>
                        </Button>
                        <Button x:Name="btPrevPage" Click="btPreviousPage_Click" Background="Transparent" HorizontalAlignment="Center" Margin="5,2,5,2" 
                                VerticalAlignment="Center" BorderThickness="0">
                            <StackPanel>
                                <Image Source="Images/PreviousPage.png" Height="32" Width="32"/>
                                <Label x:Name="lbPrevPage" HorizontalAlignment="Center"></Label>
                            </StackPanel>
                        </Button>
                        <Button x:Name="btNextPage" Background="Transparent" HorizontalAlignment="Center" Margin="5,2,5,2" 
                                VerticalAlignment="Center" BorderThickness="0" Click="btNextPage_Click" >
                            <StackPanel>
                                <Image Source="Images/NextPage.png" Height="32" Width="32"/>
                                <Label x:Name="lbNextPage" HorizontalAlignment="Center"></Label>
                            </StackPanel>
                        </Button>
                        <Button x:Name="btLastPage" Background="Transparent" HorizontalAlignment="Center" Margin="2,2,10,2" 
                                VerticalAlignment="Center" BorderThickness="0" Click="btLastPage_Click">
                            <StackPanel>
                                <Image Source="Images/LastPage.png" Height="32" Width="32"/>
                                <Label x:Name="lbLastPage" HorizontalAlignment="Center"></Label>
                            </StackPanel>
                        </Button>
                        <Separator/>
                        <Button x:Name="btZoomIn" Click="btZoomIn_Click" Background="Transparent" HorizontalAlignment="Center" Margin="10,2,2,3" 
                                VerticalAlignment="Center" BorderThickness="0">
                            <StackPanel>
                                <Image Source="Images/ZoomIn.png" Height="32" Width="32"/>
                                <Label x:Name="lbZoomIn" HorizontalAlignment="Center"></Label>
                            </StackPanel>
                        </Button>
                        <Button x:Name="btZoomOut" Click="btZoomOut_Click" Background="Transparent" HorizontalAlignment="Center" Margin="3,2,10,2" 
                                VerticalAlignment="Center" BorderThickness="0">
                            <StackPanel>
                                <Image Source="Images/ZoomOut.png" Height="32" Width="32"/>
                                <Label x:Name="lbZoomOut" HorizontalAlignment="Center"></Label>
                            </StackPanel>
                        </Button>
                        <Separator/>
                        <Button x:Name="btSearch" Click="btSearch_Click" Background="Transparent" HorizontalAlignment="Right" Margin="10,2,2,4" 
                                VerticalAlignment="Center" BorderThickness="0" MouseEnter="btSearch_MouseEnter">
                            <StackPanel>
                                <Image Source="Images/Search.png" Height="32" Width="32"/>
                                <Label x:Name="lbSearch" HorizontalAlignment="Center"></Label>
                            </StackPanel>
                        </Button>
                        <!--<TextBox x:Name="txtSearch" BorderBrush="WhiteSmoke" BorderThickness="2" HorizontalAlignment="Right" Height="20" Margin="2,2,10,2" TextWrapping="Wrap" VerticalAlignment="Center" Width="200"/>-->
                        <Separator/>
                        <Button x:Name="btNote" Background="Transparent" Click="HandleBtNote" HorizontalAlignment="Right" Margin="10,2,5,4" MouseEnter="btNote_MouseEnter"
                                VerticalAlignment="Center" BorderThickness="0">
                            <StackPanel>
                                <Image Source="Images/Note.png" Height="32" Width="32"/>
                                <Label x:Name="lbNote" HorizontalAlignment="Center"></Label>
                            </StackPanel>
                        </Button>
                        <Button x:Name="btTranslate" Click="btTranslate_Click" Background="Transparent" HorizontalAlignment="Right" Margin="5,2,10,4" 
                                VerticalAlignment="Center" BorderThickness="0" MouseEnter="btTranslate_MouseEnter" >
                            <StackPanel>
                                <Image Source="Images/googleTranslate.png" Height="32" Width="32"/>
                                <Label x:Name="lbTranslate" HorizontalAlignment="Center"></Label>
                            </StackPanel>
                        </Button>
                        <Separator/>
                        <Button x:Name="btAddToLib" Click="btAddToLib_Click" Background="Transparent" HorizontalAlignment="Right" Margin="10,2,2,4" 
                                VerticalAlignment="Center" BorderThickness="0">
                            <StackPanel>
                                <Image x:Name="AddToLibImage" Source="Images/addDB.png" Height="32" Width="32"/>
                                <Label x:Name="lbAddToLib" HorizontalAlignment="Center"></Label>
                            </StackPanel>
                        </Button>
                    </ToolBar>
                </Grid>
            </Border>

            <StatusBar x:Name="statusbar" DockPanel.Dock="Bottom" BorderBrush="LightSkyBlue" BorderThickness="2" MouseEnter="statusbar_MouseEnter">
                <StackPanel Margin="2" Orientation="Horizontal" HorizontalAlignment="Center">
                    <Label x:Name="CurrentPage" Content="0"/>
                    <Label Content="/" Margin="1,0,1,0"/>
                    <Label Width="Auto" HorizontalContentAlignment="Center" Margin="1">
                        <AccessText x:Name="lbTotalPageNo" TextWrapping="WrapWithOverflow">
                        </AccessText>
                    </Label>
                    <TextBox x:Name="txtPageNo" Width="30" Height="20" HorizontalContentAlignment="Center" Margin="1"
                             MaxLines="1" MaxLength="4"/>
                    <Button x:Name="btGotoPage" Background="Transparent" HorizontalAlignment="Center" Margin="3" 
                                VerticalAlignment="Center" BorderThickness="0" Click="btGotoPage_Click">
                        <Image Source="Images/GoToPage.png" Height="20" Width="20"/>
                    </Button>
                </StackPanel>
            </StatusBar>

            <Grid x:Name="viewGrid" Margin="0,0,0,0" Width="auto" DockPanel.Dock="Left">
                <DockPanel>
                    <Border BorderBrush="LightSkyBlue" BorderThickness="2,0,2,0" DockPanel.Dock="Top">
                        <Expander Name="labelExpand" Width="Auto" Height="Auto"  ExpandDirection="Right"
                                  Background="LemonChiffon" Content="" Expanded="labelExpand_Expanded" Collapsed="labelExpand_Collapsed" />
                    </Border>
                    <Border BorderBrush="LightSkyBlue" BorderThickness="2,1,1,0" DockPanel.Dock="Left">
                        <StackPanel x:Name="panel" Background="Azure" MouseEnter="panel_MouseEnter">
                            <Button Background="Transparent" HorizontalAlignment="Center" Margin="2" 
                                VerticalAlignment="Center" BorderThickness="0" Click="BookMark_Click">
                                <StackPanel>
                                    <Image Source="Images/BookMarkTab.png" Height="32" Width="32"/>
                                </StackPanel>
                            </Button>
                            <Button Background="Transparent" HorizontalAlignment="Center" Margin="2" 
                                VerticalAlignment="Center" BorderThickness="0" Click="Note_Click">
                                <StackPanel>
                                    <Image Source="Images/NoteTab.png" Height="32" Width="32"/>
                                </StackPanel>
                            </Button>
                        </StackPanel>
                    </Border>

                    <Border Name="bookMarkTab" BorderBrush="LightSkyBlue" BorderThickness="0,1,2,0" 
                            DockPanel.Dock="Left" Visibility="Collapsed" Width="250">
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="20"/>
                                <RowDefinition Height="*"/>
                            </Grid.RowDefinitions>
                            <Border BorderBrush="LightSkyBlue" BorderThickness="0,0,0,1">
                                <StackPanel Orientation="Horizontal" Grid.Row="0" Background="Azure">
                                    <Button x:Name="btAddBookmark" Background="Transparent" HorizontalAlignment="Center" Margin="10,2,5,2" 
                                        VerticalAlignment="Center" BorderThickness="0" Click="btAddBookmark_Click" MouseEnter="btAddBookmark_MouseEnter">
                                        <StackPanel>
                                            <Image Source="Images/AddBookMark.png" Height="16" Width="16"/>
                                        </StackPanel>
                                    </Button>
                                    <Button x:Name="btEditBookmark" Background="Transparent" HorizontalAlignment="Center" Margin="5,2,5,2" 
                                        VerticalAlignment="Center" BorderThickness="0" Click="btEditBookmark_Click">
                                        <StackPanel>
                                            <Image Source="Images/EditBookMark.png" Height="16" Width="16"/>
                                        </StackPanel>
                                    </Button>
                                    <Button x:Name="btDelBookmark" Background="Transparent" HorizontalAlignment="Center" Margin="5,2,10,2" 
                                        VerticalAlignment="Center" BorderThickness="0" Click="btDelBookmark_Click">
                                        <StackPanel>
                                            <Image Source="Images/DeleteBookMark.png" Height="16" Width="16"/>
                                        </StackPanel>
                                    </Button>
                                </StackPanel>
                            </Border>
                            <TreeView x:Name="BookmarkItemsList" Grid.Row="1" Padding="6" 
                                      SelectedItemChanged="BookmarkItemsList_SelectedItemChanged" ContextMenu="{StaticResource bookmarkTabContextMenu}" >
                            </TreeView>
                        </Grid>
                    </Border>

                    <Border Name="noteTab" BorderBrush="LightSkyBlue" BorderThickness="0,1,2,0" 
                            DockPanel.Dock="Left"  Visibility="Collapsed" Width="250">
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="20"/>
                                <RowDefinition Height="*"/>
                            </Grid.RowDefinitions>
                            <Border BorderBrush="LightSkyBlue" BorderThickness="0,0,0,1">
                                <StackPanel Orientation="Horizontal" Grid.Row="0" Background="Azure">
                                    <Button x:Name="btEditNote" Background="Transparent" HorizontalAlignment="Center" Margin="5,2,5,2" 
                                        VerticalAlignment="Center" BorderThickness="0" Click="HandleBtEditNote">
                                        <StackPanel>
                                            <Image Source="Images/EditNote.png" Height="16" Width="16"/>
                                        </StackPanel>
                                    </Button>
                                    <Button x:Name="btDelNote" Background="Transparent" HorizontalAlignment="Center" Margin="5,2,10,2" 
                                        VerticalAlignment="Center" BorderThickness="0" Click="HandleBtDelNote">
                                        <StackPanel>
                                            <Image Source="Images/DeleteNote.png" Height="16" Width="16"/>
                                        </StackPanel>
                                    </Button>
                                </StackPanel>
                            </Border>
                            <ListView Name="NoteWordListView" Grid.Row="1" Padding="6" ItemTemplate="{StaticResource noteViewTemplate}" MouseDoubleClick="HandleDoubleClick" ContextMenu="{StaticResource noteTabContextMenu}" >
                                <ListView.ItemContainerStyle>
                                    <Style TargetType="ListViewItem">
                                        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
                                        <Setter Property="HorizontalAlignment" Value="Stretch"/>
                                    </Style>
                                </ListView.ItemContainerStyle>
                            </ListView>
                        </Grid>
                    </Border>
                </DockPanel>
            </Grid>

            <Grid DockPanel.Dock="Right">
                <WindowsFormsHost x:Name="ebookControl" MouseLeave="ebookControl_MouseLeave"/>
                <StackPanel x:Name="LoadingField" VerticalAlignment="Center">
                    <Image x:Name="LoadingImage" Source="Images/LoadingDefault.png" Height="100" Width="100"
                        RenderTransformOrigin=".5,.5"/>
                    <Label x:Name="LoadingLabel" Content="Loading" 
                        HorizontalAlignment="Center" VerticalAlignment="Center"/>
                </StackPanel>
            </Grid>
        </DockPanel>
        </controls:DialogPresenter>
    </Grid>
    <Window.CommandBindings>
        <CommandBinding Command="NextPage" Executed="btNextPage_Click"/>
        <CommandBinding Command="PreviousPage" Executed="btPreviousPage_Click"/>
    </Window.CommandBindings>
    <Window.InputBindings>
        <KeyBinding Command="NextPage" Key="K" />
        <KeyBinding Command="PreviousPage" Key="Back" />
    </Window.InputBindings>
</Window>
